<!-- <template>
	<view class="member">
		<view class="member_box">
			<view class="member_box_top">
				<view class="member_box_top_box">
					<view class="member_box_top_box_left">
						<image :src="res.avatar?res.avatar:'../../static/logo.png'" mode="widthFix"></image>
						<view class="member_box_top_box_left_text">
							<view class="member_box_top_box_left_text_title">
								<view class="member_box_top_box_left_text_title_name">
									{{res.nickname}}
								</view>
								<view class="jibiei">
									{{res.levelname}}
								</view>
							</view>
							<view class="member_box_top_box_left_text_InvitationCode">
								邀请码：{{res.id}}
							</view>
						</view>
					</view>
					<view class="member_box_top_box_right">
						<view class="member_box_top_box_right_personalDetails"
							@click="toFun('/pages/member/edit_personage_information/edit_personage_information')">
							<uni-icons type="person-filled" color="#fff" size="18"></uni-icons>
							<p>个人信息</p>
						</view>
					</view>
				</view>
				<view class="member_box_top_bottom">
					<view class="member_box_top_bottom_row">
						<view class="member_box_top_bottom_row_item"
							@click="toFun('/pages/member/Details/Details?type=credit2&title=余额')">
							<span>{{res.credit2}}</span>
							<p>余额</p>
						</view>
						<view class="member_box_top_bottom_row_item items">
							<span>{{res.zt_num}}</span>
							<p>分享统计</p>
						</view>
						<view class="member_box_top_bottom_row_item"
							@click="toFun('/pages/member/Details/Details?type=ymd&title=YMD通证')">
							<span>{{res.ymd}}</span>
							<p>YMD通证</p>
						</view>
					</view>
					<view class="member_box_top_bottom_row">
						<view class="member_box_top_bottom_row_item"
							@click="toFun('/pages/member/Details/Details?type=qyjf&title=Y积分')">
							<span>{{res.qyjf}}</span>
							<p>Y积分</p>
						</view>
						<view class="member_box_top_bottom_row_item items"
							@click="toFun('/pages/member/Details/Details?type=mjfC&title=M积分')">
							<span>{{res.mjf}}</span>
							<p>M积分</p>
						</view>
						<view class="member_box_top_bottom_row_item"
							@click="toFun('/pages/member/Details/Details?type=djf&title=D积分')">
							<span>{{res.djf}}</span>
							<p>D积分</p>
						</view>
					</view>
				</view>
			</view>
			<view class="member_box_zhuanqudingdan">
				<uni-card title="直供区" extra="全部"
					@click="toFun('/pages/member/OrderFormListList/OrderFormListList?order_gift=5&title=直供专区')">
					<view class="member_box_zhuanqudingdan_box">
						<view class="member_box_zhuanqudingdan_box_item" v-for="(item,index) in dingdanType"
							:key="index"
							@click.stop="toFun(`/pages/member/OrderFormListList/OrderFormListList?order_gift=5&title=直供专区&type=${index}`)">
							<image :src="item.image" mode="widthFix"></image>
							<p>{{item.text}}</p>
						</view>
					</view>
				</uni-card>
			</view>
			<view class="member_box_zhuanqudingdan">
				<uni-card title="热销区" extra="全部"
					@click="toFun('/pages/member/OrderFormListList/OrderFormListList?order_gift=10&title=热销专区')">
					<view class="member_box_zhuanqudingdan_box">
						<view class="member_box_zhuanqudingdan_box_item" v-for="(item,index) in dingdanType"
							:key="index"
							@click.stop="toFun(`/pages/member/OrderFormListList/OrderFormListList?order_gift=10&title=热销专区&type=${index}`)">
							<image :src="item.image" mode="widthFix"></image>
							<p>{{item.text}}</p>
						</view>
					</view>
				</uni-card>
			</view>
			<view class="member_box_zhuanqudingdan">
				<uni-card title="兑换区" extra="全部"
					@click="toFun('/pages/member/OrderFormListList/OrderFormListList?order_gift=15&title=兑换专区')">
					<view class="member_box_zhuanqudingdan_box">
						<view class="member_box_zhuanqudingdan_box_item" v-for="(item,index) in dingdanType"
							:key="index"
							@click.stop="toFun(`/pages/member/OrderFormListList/OrderFormListList?order_gift=15&title=兑换专区&type=${index}`)">
							<image :src="item.image" mode="widthFix"></image>
							<p>{{item.text}}</p>
						</view>
					</view>
				</uni-card>
			</view>
			<view class="member_box_zhuanqudingdan">
				<uni-card title="生态区" extra="全部"
					@click="toFun('/pages/member/OrderFormListList/OrderFormListList?order_gift=20&title=生态专区')">
					<view class="member_box_zhuanqudingdan_box">
						<view class="member_box_zhuanqudingdan_box_item" v-for="(item,index) in dingdanType"
							@click.stop="toFun(`/pages/member/OrderFormListList/OrderFormListList?order_gift=20&title=生态专区&type=${index}`)"
							:key="index">
							<image :src="item.image" mode="widthFix"></image>
							<p>{{item.text}}</p>
						</view>
					</view>
				</uni-card>
			</view>
			<view class="member_box_zhuanqudingdan">
				<uni-card title="常用服务" extra="">
					<view class="changyongbox">
						<view class="changyongbox_item" @click="toFun('/pages/member/myTeam/myTeam')">
							<image src="../../static/member/wdtd.png" mode="widthFix"></image>
							我的团队
						</view>
						<view class="changyongbox_item" @click="toFun('/pages/member/addressList/addressList')">
							<image src="../../static/member/shdz.png" mode="widthFix"></image>
							收货地址
						</view>
						<view class="changyongbox_item"
							@click="toFun('/pages/member/set_password/set_password?type=0')">
							<image src="../../static/member/dlmm.png" mode="widthFix"></image>
							修改密码
						</view>
						<view class="changyongbox_item"
							@click="toFun('/pages/member/set_password/set_password?type=1')">
							<image src="../../static/member/dlmm.png" mode="widthFix"></image>
							交易密码
						</view>
						<view class="changyongbox_item" @click="toFun('/pages/member/Conversion/Conversion?type=mjf')">
							<image src="../../static/member/qb.png" mode="widthFix"></image>
							M积分转余额
						</view>
						<view class="changyongbox_item" @click="toFun('/pages/member/Conversion/Conversion??type=ymd')">
							<image src="../../static/member/qb.png" mode="widthFix"></image>
							通证转余额
						</view>
						<view class="changyongbox_item">
							<image src="../../static/member/kf.png" mode="widthFix"></image>
							邀请海报
						</view>
					</view>
				</uni-card>
			</view>
			<view class="quit_login" @click="quitloginFun">
				<view class="quit_login_box">
					退出登录
				</view>
			</view>
		</view>
		<tab-ber :current='3'></tab-ber>
	</view>
</template>

<script>
	import tabBer from '@/components/appTab/appTab.vue';

	import {
		member
	} from '@/api/member.js'
	export default {
		components: {
			tabBer
		},
		data() {
			return {
				openid: '',
				res: '',
				dingdanType: [{
					image: '../../static/member/dfk.png',
					text: '待付款'
				}, {
					image: '../../static/member/dfh.png',
					text: '待发货'
				}, {
					image: '../../static/member/dsh.png',
					text: '待收货'
				}, {
					image: '../../static/member/ywc.png',
					text: '已完成'
				}]
			};
		},
		onShow() {
			uni.hideTabBar();
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data;
					this.memberFun(this.openid);
				},
				fail: () => {
					uni.reLaunch({
						url: '/pages/login/login'
					});
				}
			});
		},
		methods: {
			toFun(url) {
				uni.navigateTo({
					url
				})
			},
			async memberFun(openid) {
				let data = await member(openid);
				this.res = data;
			},
			quitloginFun() {
				this.showinteraction('退出成功');
				setTimeout(() => {
					uni.clearStorage();
					uni.reLaunch({
						url: '/pages/home/home'
					})
				}, 1000)
			},
			//提示
			showinteraction(title, icon = 'none') {
				uni.showToast({
					title,
					icon,
					duration: 2000,
					mask: false
				})
			},
		}
	}
</script>

<style lang="less">
	.member {
		width: 100%;
		height: 100vh;
		display: flex;
		flex-direction: column;
		padding-top: var(--status-bar-height);

		.member_box {
			flex: 1;
			width: 100%;
			// padding: 20rpx 0;
			padding-bottom: 20rpx;
			overflow-y: auto;
			background-color: #F9F9F9;

			.member_box_top {
				width: 100%;
				height: 440rpx;
				background-image: url('@/static/login/login_back.png');
				background-repeat: no-repeat;
				background-size: 100% 100%;
				padding: 150rpx 50rpx 0 50rpx;
				position: relative;
				margin-bottom: 140rpx;

				.member_box_top_box {
					width: 100%;
					height: 150rpx;
					// border-bottom: 20rpx;
					display: flex;

					.member_box_top_box_left {
						display: flex;

						image {
							width: 140rpx;
							border-radius: 100rpx;
						}

						.member_box_top_box_left_text {
							width: 350rpx;
							height: 100%;
							padding: 20rpx;
							color: #fff;

							.member_box_top_box_left_text_title {
								width: 100%;
								margin-bottom: 10rpx;
								display: flex;
								align-items: center;

								.member_box_top_box_left_text_title_name {
									max-width: 200rpx;
									text-wrap: nowrap;
									text-overflow: ellipsis;
									overflow: hidden;
								}

								.jibiei {
									height: 60rpx;
									width: 60rpx;
									background-image: url('../../static/member/jp.png');
									background-repeat: no-repeat;
									background-size: 100%;
									font-size: 16rpx;
									line-height: 56rpx;
									text-align: center;
									color: #333;

								}
							}
						}
					}

					.member_box_top_box_right {
						flex: 1;
						display: flex;
						align-items: center;

						.member_box_top_box_right_personalDetails {
							width: 156rpx;
							height: 42rpx;
							background-color: #ff3232;
							border-radius: 100rpx;
							display: flex;
							// justify-content: center;
							padding: 0 10rpx;
							font-size: 20rpx;
							color: #fff;
							align-items: center;

							p {
								padding: 0 10rpx;
							}
						}
					}
				}

				.member_box_top_bottom {
					width: 668rpx;
					// height: 165px;
					background: #fff;
					border-radius: 20px;
					left: 0;
					right: 0;
					margin: 0 auto;
					margin-top: 20rpx;
					position: absolute;
					z-index: 10;
					padding: 20rpx;

					.member_box_top_bottom_row {
						width: 100%;
						height: 50%;
						display: flex;
						// justify-content: space-between;

						.member_box_top_bottom_row_item {
							width: 33.33%;
							height: 100rpx;
							position: relative;
							text-align: center;
							// display: flex;


							span {
								font-size: 24rpx;
								display: block;
							}

							p {
								font-size: 26rpx;
								line-height: 50rpx;
								font-family: Microsoft YaHei;
								font-weight: 700;
								color: #2c2c2c;
							}

						}

						.items::after {
							width: 2rpx;
							height: 40rpx;
							content: '';
							position: absolute;
							border-left: 1rpx solid #ccc;
							top: 0;
							bottom: 0;
							right: 0;
							margin: auto;
						}

						.items::before {
							width: 2rpx;
							height: 40rpx;
							content: '';
							position: absolute;
							border-left: 1rpx solid #ccc;
							top: 0;
							bottom: 0;
							left: 0;
							margin: auto;
						}
					}


				}
			}

			.member_box_zhuanqudingdan {
				width: 100%;
				min-height: 248rpx;
				padding: 0 16rpx;

				.member_box_zhuanqudingdan_box {
					width: 100%;
					// height: 100rpx;
					margin-top: 10rpx;
					display: flex;

					.member_box_zhuanqudingdan_box_item {
						width: 25%;
						height: 100%;
						display: flex;
						flex-direction: column;
						align-items: center;

						image {
							width: 48rpx;
							height: 48rpx;
						}

						p {
							margin-top: 20rpx;
						}
					}

				}


				.changyongbox {
					width: 100%;
					display: flex;
					flex-wrap: wrap;

					.changyongbox_item {
						width: 25%;
						// height: 100rpx;
						font-size: 22rpx;
						display: flex;
						flex-direction: column;
						align-items: center;
						margin: 20rpx 0;

						image {
							width: 60rpx;
						}
					}
				}

			}

			.quit_login {
				padding: 0 41rpx;
				margin: 30rpx 0;

				.quit_login_box {
					width: 100%;
					height: 80rpx;
					background: linear-gradient(3deg, #ff3232, #ff3232, #ff8719);
					border-radius: 20px;
					font-size: 15px;
					font-family: Microsoft YaHei;
					font-weight: 400;
					color: #fff;
					line-height: 40px;
					text-align: center;
				}
			}
		}
	}
</style> -->








<template>
	<view class="member">
		<view class="member_box">
			<view class="member_box_top">
				<view class="member_box_top_user">
					<view class="member_box_top_user_image"
						@click="GoFun('/pages/member/edit_personage_information/edit_personage_information')">
						<image :src="res.avatar?res.avatar:'../../static/member/default_avatar.png'" mode=""></image>
					</view>
					<view class="member_box_top_user_Information">
						<view class="member_box_top_user_Information_name">
							{{res?res.nickname:"****同学"}}
						</view>
						<!-- <span class="member_box_top_user_Information_Level" v-if="res.levelname === '普通会员'">
							普通会员
						</span>
						<view class="" v-else>
							<image style="width: 150rpx;" :src="res.levelname" mode="widthFix"></image>
						</view> -->
					</view>
					<view class="member_box_top_user_Information">
						<view class="member_box_top_user_Information_ID ">
							{{res? res.mobile : ''}}
						</view>
						<span class="member_box_top_user_Information_Telephone">
							ID：{{res.id ? res.id : "000000"}}
						</span>
					</view>
					<view class="member_box_top_user_Information"
						@click="GoFun('/pages/member/edit_personage_information/edit_personage_information')"
						style="width: 80rpx;font-size: 24rpx;display: flex;align-items: flex-end;justify-content: flex-end;">
						<p>设置</p>
						<uni-icons type="right" color="#fff"></uni-icons>
					</view>
				</view>

				<p style="padding: 0 20rpx; color: #fff;font-size: 26rpx;">{{res.levelname}}</p>

			</view>
			<view class="member_box_center">
				<view class="member_box_center_OrderFormList">
					<view class="member_box_center_OrderFormList_top">
						<h3>我的订单</h3>
						<view class="member_box_center_OrderFormList_top_right"
							@click="GoFun('/pages/member/OrderFormList/OrderFormList')">
							全部订单
							<uni-icons type="right" size="12"></uni-icons>
						</view>
					</view>
					<view class="member_box_center_OrderFormList_bottom">
						<view class="member_box_center_OrderFormList_bottom_item"
							@click="GoFun('/pages/member/OrderFormList/OrderFormList?type=1')">
							<image src="@/static/member/daifukuan.png" mode=""></image>
							<view class="member_box_center_OrderFormList_bottom_item_text">
								待发货
							</view>
						</view>
						<view class="member_box_center_OrderFormList_bottom_item"
							@click="GoFun('/pages/member/OrderFormList/OrderFormList?type=2')">
							<image src="@/static/member/daifahuo.png" mode=""></image>
							<view class="member_box_center_OrderFormList_bottom_item_text">
								待收货
							</view>
						</view>
						<view class="member_box_center_OrderFormList_bottom_item"
							@click="GoFun('/pages/member/OrderFormList/OrderFormList?type=3')">
							<image src="@/static/member/yiwancheng.png" mode=""></image>
							<view class="member_box_center_OrderFormList_bottom_item_text">
								已完成
							</view>
						</view>
						<view class="member_box_center_OrderFormList_bottom_item" @click="GoFun()">
							<image src="@/static/member/tuikuanshouhou.png" mode=""></image>
							<view class="member_box_center_OrderFormList_bottom_item_text">
								退款/售后
							</view>
						</view>
					</view>
				</view>
				<view class="member_box_center_CommonlyUsed">
					<!-- <u-grid :col="4">
						<u-grid-item v-for="(item,index) in baseList" :key="index" @click="GoFun(item.pages)">
							<image style="width: 60rpx;margin: 30rpx 0;height: 60rpx;" :src="item.image" mode="">
							</image>
							<text style="color: #F3D79C;font-size: 28rpx;">{{item.title}}</text>
						</u-grid-item>
					</u-grid> -->
					<view class="member_box_center_CommonlyUsed_item" v-for="(item,index) in baseList" :key="index"
						@click="GoFun(item.pages)">
						<view class="member_box_center_CommonlyUsed_item_left">
							<image :src="item.image" style="width: 42rpx;" mode="widthFix"></image>
						</view>
						<view class="member_box_center_CommonlyUsed_item_right">
							<p>{{item.title}}</p>
							<uni-icons type="right"></uni-icons>
						</view>
					</view>
				</view>
				<image v-if="openid !== ''" src="@/static/member/backImage.png" style="margin: 60rpx 0; height: 88rpx;"
					mode="heightFix" @click="quitloginFun">
				</image>
			</view>
		</view>
		<tab-ber :current='3'></tab-ber>
	</view>
</template>

<script>
	import tabBer from '@/components/appTab/appTab.vue';
	import {
		member
	} from '@/api/member.js'
	export default {
		components: {
			tabBer
		},
		data() {
			return {
				openid: '',
				res: '',
				baseList: [{
						image: '../../static/member/wodeshequ.png',
						title: '我的社区',
						pages: '/pages/member/MyCommunity/MyCommunity',
					},
					// {
					// 	image: '../../static/member/yinhangka.png',
					// 	title: '银行卡',
					// 	pages: '/pages/member/BankTiedCard/BankTiedCard'
					// }, 
					// {
					// 	image: '../../static/member/shimingrenzheng.png',
					// 	title: '实名认证'
					// }, 
					{
						image: '../../static/member/setPassword.png',
						title: '密码设置',
						pages: "/pages/member/set_password/set_password?type=0"
					}, {
						image: '../../static/member/dizhiguanli.png',
						title: '地址管理',
						pages: '/pages/member/addressList/addressList'
					},
					// {
					// 	image: '../../static/member/pingtaixieyi.png',
					// 	title: '平台协议'
					// },
					{
						image: '../../static/member/yaoqingma.png',
						title: '邀请码',
						pages: '/pages/member/InvitationCode/InvitationCode'
					}, {
						image: '../../static/member/banbenhao.png',
						title: '版本号'
					}
				]
			};
		},
		onShow() {
			uni.hideTabBar();
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data;
					this.memberFun();
				},
				fail: () => {
					uni.reLaunch({
						url: '/pages/login/login'
					});
				}
			});
		},
		methods: {
			async memberFun() {
				let data = await member(this.openid);
				console.log(data);
				this.res = data;
			},
			//提示
			showinteraction(title, icon = 'none') {
				uni.showToast({
					title,
					icon,
					duration: 2000,
					mask: false
				})
			},
			quitloginFun() {
				this.showinteraction('退出成功');
				setTimeout(() => {
					uni.clearStorage();
					uni.reLaunch({
						url: '/pages/home/home'
					})
				}, 1000)
			},
			gridClickFun(e) {
				console.log(e);
			},
			GoFun(url = '') {
				if (this.openid) {
					if (url) {
						uni.navigateTo({
							url
						})
					} else {
						this.showinteraction('暂未开放');
					}
				} else {
					uni.redirectTo({
						url: '/pages/login/login'
					})
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.member {
		width: 100%;
		height: 100vh;
		display: flex;
		flex-direction: column;

		.member_box {
			flex: 1;
			// background-color: #1C1714;
			position: relative;
			display: flex;
			flex-direction: column;
			align-items: center;
			// overflow-y: auto;
			background-image: url('@/static/member/memberTops.png');
			background-repeat: no-repeat;
			background-size: 100%;

			.member_box_top {
				width: 90%;
				height: 230rpx;
				margin-top: 92rpx;

				.member_box_top_user {
					width: 100%;
					height: 70%;
					// padding: 0 20rpx;
					padding-top: 20rpx;
					display: flex;
					position: relative;

					.member_box_top_user_image {
						width: 133rpx;
						height: 133rpx;
						margin-right: 40rpx;
						border-radius: 100rpx;
						overflow: hidden;
						background-color: #fff;

						image {
							width: 100%;
							height: 100%;
						}
					}

					.member_box_top_user_Information {
						width: 190rpx;
						height: 100%;
						color: #fff;
						padding: 18rpx 0;
						font-size: 26rpx;

						.member_box_top_user_Information_name {
							font-size: 40rpx;
							font-weight: 500;
							margin-bottom: 15rpx;
							height: 52rpx;
							text-wrap: nowrap;
							overflow: hidden;
							text-overflow: ellipsis;
						}

						.member_box_top_user_Information_ID {
							height: 52rpx;
							margin-bottom: 15rpx;
						}


						.member_box_top_user_Information_Level {
							// padding: 5rpx 30rpx;
							width: 168rpx;
							border: 2rpx solid #fff;
							border-radius: 100rpx;
							display: inline-block;
							max-width: 100%;
							text-wrap: nowrap;
							overflow: hidden;
							text-overflow: ellipsis;
							text-align: center;
							font-size: 22rpx;
						}
					}

					.member_box_top_user_set {
						position: absolute;
						bottom: -30rpx;
						font-size: 20rpx;
						color: #FFD489;
						left: 65rpx;
						z-index: 1000;
					}
				}
			}

			.member_box_center {
				width: 100%;
				min-height: 920rpx;
				// padding: 0 35rpx;
				padding-top: 40rpx;
				display: flex;
				flex-direction: column;
				align-items: center;

				.member_box_center_OrderFormList {
					width: 100%;
					// height: 210rpx;
					// background-image: url('@/static/member/memberdingdan.png');
					background-size: 100%;
					background-repeat: no-repeat;
					display: flex;
					flex-direction: column;

					.member_box_center_OrderFormList_top {
						width: 100%;
						// height: 64rpx;
						display: flex;
						justify-content: space-between;
						padding: 0 20rpx 20rpx 20rpx;
						align-items: center;
						margin-top: 20rpx;

						h3 {
							font-size: 30rpx;
							margin-left: 20rpx;
						}

						.member_box_center_OrderFormList_top_right {
							font-size: 24rpx;
							color: #4E4D52;
						}
					}

					.member_box_center_OrderFormList_bottom {
						width: 100%;
						flex: 1;
						display: flex;
						padding: 0 15rpx;

						.member_box_center_OrderFormList_bottom_item {
							flex: 1;
							height: 100%;
							display: flex;
							// justify-content: center;
							flex-direction: column;
							align-items: center;

							image {
								width: 100rpx;
								height: 100rpx;
							}

							.member_box_center_OrderFormList_bottom_item_text {
								font-size: 24rpx;
								font-weight: 500;
								margin-top: 20rpx;
							}
						}
					}

				}


				.member_box_center_CommonlyUsed {
					width: 100%;
					margin-top: 20rpx;

					.member_box_center_CommonlyUsed_item {
						width: 100%;
						height: 88rpx;
						padding: 0 30rpx 0 80rpx;
						display: flex;
						align-items: center;
						margin-top: 30rpx;

						.member_box_center_CommonlyUsed_item_left {}

						.member_box_center_CommonlyUsed_item_right {
							flex: 1;
							height: 88rpx;
							line-height: 88rpx;
							border-bottom: 2rpx solid #F5F5F5;
							padding: 0 20rpx;
							margin-left: 20rpx;
							color: #514F64;
							display: flex;
							justify-content: space-between;
						}
					}
				}
			}
		}

	}
</style>